﻿using RedmineTypes = Redmine.Net.Api.Types;

namespace Redmine.Laptop.API.Models
{
    public class IssueStatus
    {
        public int StatusID { get; set; }
        public string StatusName { get; set; }
        public bool IsClosed { get; set; }
        public bool IsDefault { get; set; }

        public static explicit operator RedmineTypes::IssueStatus(IssueStatus issueStatus)
        {
            return new RedmineTypes::IssueStatus
                       {
                          Id = issueStatus.StatusID,
                          Name = issueStatus.StatusName,
                          IsClosed = issueStatus.IsClosed,
                          IsDefault = issueStatus.IsDefault
                       };
        }

        public static explicit operator IssueStatus(RedmineTypes::IssueStatus issueStatus)
        {
            return new IssueStatus
                       {
                           IsClosed = issueStatus.IsClosed,
                           IsDefault = issueStatus.IsDefault,
                           StatusID = issueStatus.Id,
                           StatusName = issueStatus.Name
                       };
        }
    }
}
